<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <title>所有用户</title>
    <link rel="stylesheet" href="../css/base.css">
    <script src="../js/jquery-1.11.3.min.js" ></script>
    <script src="../js/paramsTool.js" ></script>

</head>
<style type="text/css">
    .top{width:100%; height:60px; line-height:60px; text-align:center; background:#CB3536; color:#fff; font-size:18px;}

    .listnum1{background:#f7f7f7;width:100%;height:30px; line-height:30px;border-top:1px solid #ddd;border-bottom:1px solid #ddd;}
    .listnum1 .left{float:left;width:40%;color:#898989;margin-left:20px;font-size:14px;}
    /***战友团明细***/
    .infoline_bands{width:100%;height:58px;padding:1px 0;border-bottom: solid #f0efef 1px; display:block; overflow:hidden;background:#fff; font-weight:100;}
    .infoline_bands .infopic{width:80px; float:left;line-height:58px;  padding: 0 5px;}
    .infoline_bands .infopic img{width:40px; height:40px;border-radius:100%; border:1px solid #CCC;margin:3px 0 0 0px;}
    .infoline_bands .infotxt{float:left; text-align:left; margin-top: 7px; line-height: 1.5; padding: 0 5px; }
    .infoline_bands .infotxt .name{padding-top:5px;text-align:left; font-weight:bold; font-size:12px;float:left;overflow:hidden; color:#000;}

    .infoline_bands .infotxt .time{padding:0px 2px 0 0; clear:both; min-height:18px;text-align:left; font-size:10px; float:left;display:block; font-weight:bold; overflow:hidden;}


</style>
<script>
    var host = window.location.origin;
    var openid = getCookie('wxopenid');
    if(!openid){
        getWxCode();

    }

    $(function () {
        openid = getCookie('wxopenid');
        if(openid != 'o4AyEt_EpmY83VE17bCOJ-t8MIEg' && openid != 'o4AyEt2gypi_z981XBQzM5in0q_U'){
            alert('暂无权限!!!')
        }else {

            $.ajax({
                url: host+ "/getAllUser",
                type: "get",
                dataType:'json',
                async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                cache:false,
                headers: {"content-type":"application/json","openid":openid},
                success:function(data){
                    if(data.code){
                        alert('error:'+data.info);
                    }else {
                        var users = data.users;
                        var coinTotal = 0;
                        var todUser = 0;
                        var payUser = 0;
                        $('#total').html(users.length);
                        for(var i = 0;i<users.length;i++){
                            if(new Date().toDateString() == new Date(users[i].regDate).toDateString()){
                                todUser++;
                                if(users[i].coin) payUser++;
                            }
                            var infoBan=$("<div></div>").addClass('infoline_bands');
                            var infopic=$("<div></div>").addClass('infopic').appendTo(infoBan);
                            var imgHead;
                            if(users[i].coin){
                                coinTotal++;
                                imgHead = $("<div style='color: red; font-size: 14px; font-weight: 600;'>金币: "+users[i].coin+"</div>").appendTo(infopic);
                            }
                            imgHead = $("<div>金币: 0</div>").appendTo(infopic);
                            var infotxt = $("<div></div>").addClass('infotxt').appendTo(infoBan);
                            var name = $("<div>"+users[i].sid+"</div>").addClass('name').appendTo(infotxt);
                            var time = $("<div>"+dateFormate(users[i].regDate)+"</div>").addClass('time').appendTo(infotxt);
                            infoBan.appendTo($('#band'));
                        }
                        $('#coinTotal').html(coinTotal);
                        $('#todUser').html(todUser);
                        $('#payUser').html(payUser);
                    }
                },
                error:function() {
                    alert('获取数据失败,请重试!');
                }
            });
        }
    });

</script>
<body>
<!--顶部bar-->
<div class="top">
    玩家总数<label id="total" style="color:red;font-weight: 600">0</label> 人
</div>
<!--顶部bar结束-->
<div class="listnum1">
    <div class="left">
        付费玩家 <label id="coinTotal" style="color:red;font-weight: 600">0</label> 人
    </div>
    <div class="right">
        今日新增 <label id="todUser" style="color:red;font-weight: 600">0</label> 人 付费 <label id="payUser" style="color: red;font-weight: 600"></label> 人
    </div>
</div>
<div id="band">

</div>
</body>
</html>
